<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../common/base_body_header.jsp" %>

<div class="page-content">
    <div class="row">
        <div class="col-xs-12">
            <div class="widget-box">
                <div class="widget-header">
                    <h4>我的课程</h4>
                </div>

                <input id="phone" type="hidden" value="${phone}">
                <input id="exp" type="hidden" value="${exp}">

                <div class="widget-body">
                    <div class="widget-main no-padding center">
                        <form:form class="form-horizontal" modelAttribute="sysUser"
                                   action="${GLOBAL.basePath}/sysuser/save" method="post" id="sysUserForm">
                            <%--<c:if test="${not empty course}">--%>
                                <%--<fieldset>--%>
                                    <%--<video src="${course.videoUrl}" width="95%"--%>
                                           <%--controls="controls"/>--%>
                                <%--</fieldset>--%>
                            <%--</c:if>--%>

                            <c:choose>
                                <c:when test="${not empty course}">
                                    <c:forEach items="${course}" var="item" varStatus="cuorseStatus">
                                        <fieldset>
                                            <button type="button" class="btn btn-sm btn-info" style="width: 90%" onclick="view_btn(${item.id})">
                                                ${item.coursName}
                                            </button>
                                        </fieldset>
                                    </c:forEach>
                                </c:when>

                                <c:otherwise>
                                    <fieldset>
                                        <img src="${GLOBAL.basePath}/images/free.jpeg"
                                             width="95%">
                                    </fieldset>

                                    <div class="form-actions">
                                        <button type="button" class="btn btn-sm btn-success" style="width: 90%"
                                                onclick="receive_btn()">
                                            领取课程
                                        </button>
                                        <br/><br/>
                                        <span><font color="red">领取课程后,下次可在首页输入手机号查询课程</font></span>                                    </div>
                                </c:otherwise>
                            </c:choose>

                            <fieldset>
                                <img src="${GLOBAL.basePath}/images/buy.jpeg"
                                     width="95%">
                            </fieldset>

                            <div class="form-actions">
                                <button type="button" class="btn btn-sm btn-success" style="width: 90%" onclick="buy_btn()">
                                    新用户特惠购买(仅有一次机会)
                                </button>
                            </div>
                        </form:form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="mask" class="img"></div>
</div>
<%@include file="../common/page_content_suf.jsp" %>
<%@include file="../common/script1.jsp" %>

<script>
    function showMask() {
        $("body").mLoading();
        $("#campusdsr").submit();
    }

    function view_btn(courseId) {
        var exp = $("#exp").val();
        var phone = $("#phone").val();

        document.location.href = "${GLOBAL.basePath}/Emily/viewCourse?courseId="+courseId+"&exp="+exp+"&phone="+phone;
    }

</script>